/*
 * @Author: your name
 * @Date: 2021-04-20 18:31:15
 * @LastEditTime: 2021-04-20 19:03:03
 * @LastEditors: Please set LastEditors
 * @Description: In User Settings Edit
 * @FilePath: \api\lib\ScrollPhysics.dart
 */

import 'package:flutter/material.dart';

class ScrollPhysicsApi extends StatefulWidget {
  ScrollPhysicsApi({Key key}) : super(key: key);

  @override
  _ScrollPhysicsState createState() => _ScrollPhysicsState();
}

class _ScrollPhysicsState extends State<ScrollPhysicsApi> {
  @override
  Widget build(BuildContext context) {
    return CustomScrollView(
      physics: ClampingScrollPhysics(),
      slivers: <Widget>[
        SliverGrid.count(
          crossAxisCount: 4,
          children: List.generate(8, (index) {
            return Container(
              color: Colors.primaries[index % Colors.primaries.length],
              alignment: Alignment.center,
              child: Text(
                '$index',
                style: TextStyle(color: Colors.white, fontSize: 20),
              ),
            );
          }).toList(),
        ),
        SliverList(
          delegate: SliverChildBuilderDelegate((content, index) {
            return Container(
              height: 85,
              alignment: Alignment.center,
              color: Colors.primaries[index % Colors.primaries.length],
              child: Text(
                '$index',
                style: TextStyle(color: Colors.white, fontSize: 20),
              ),
            );
          }, childCount: 25),
        )
      ],
    );
  }
}
